/********************************************
 * 功能说明: 
 * 模块名称: 
 * 系统名称: 
 * 软件版权: Frank
 * 系统版本: 1.0.0
 * 开发人员: Frank
 * 开发时间: 2019/12/12 10:40
 * 审核人员: 
 * 相关文档: 
 * 修改记录: 修改日期 修改人员 修改说明
 *********************************************/
package com.spring.arch.uaa.repository;

import com.spring.arch.uaa.enums.AuthorityType;
import com.spring.arch.uaa.model.Authority;
import com.spring.arch.uaa.enums.AuthorityType;
import com.spring.arch.uaa.model.Authority;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.Repository;
import org.springframework.http.HttpMethod;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

/**
 * 资源权限持久层接口
 *
 * @author Frank
 * @version 1.0.0.1
 * @since 2019/12/12 10:40
 */
@org.springframework.stereotype.Repository
public interface AuthorityRepository extends Repository<Authority, UUID>, QuerydslPredicateExecutor<Authority> {

    Authority save(Authority model);

    Optional<Authority> findById(UUID id);

    Optional<Authority> findByCode(String code);

    Page<Authority> findAll(Pageable pageable);

    List<Authority> findByCodeStartingWith(String codePrefix);

    List<Authority> saveAll(Iterable<Authority> list);

    void delete(Authority tenant);

    void deleteById(UUID id);

    List<Authority> findByHttpMethodAndTypeAndDisableFalse(HttpMethod method, AuthorityType url);
}
